package com.xxx.obj;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/7/16 15:16
 * @Copyright 博为峰
 */
public class Student {
    private String name;
    private int age;

    public Student() {
    }

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean equals(Object obj) {//Object obj = new Student("张三", 20);
        Student s2 = (Student) obj;
        if (this.name.equals(s2.name) && this.age == s2.age) {
            return true;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return this.age + this.name.hashCode();
    }

    public String toString() {
        return this.name + "," + this.age;
    }


}
